'use strict';

import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'

//获取部门交底书排名
export function getDepartmentRanking() {
    return dispatch => basicAction({
        type: 'get',
        dispatch: dispatch,
        actionType: 'GET_DEPARTMENT_RANKING',
        url: `${ApiTable.getDepartmentRanking}`,
        msg: { error: '获取部门交底书排名失败' },
        reducer: { name: 'departmentRanking' }
    });
}

//获取部门受理量排名
export function getAcceptedCasesRanking() {
    return dispatch => basicAction({
        type: 'get',
        dispatch: dispatch,
        actionType: 'GET_ACCEPTED_CASES_RANKING',
        url: `${ApiTable.getAcceptedCasesRanking}`,
        msg: { error: '获取部门受理量排名失败' },
        reducer: { name: 'acceptedCasesRanking' }
    });
}

//获取知识产权类型分布占比
export function getTypeDistribution() {
    return dispatch => basicAction({
        type: 'get',
        dispatch: dispatch,
        actionType: 'GET_TYPE_DISTRIBUTION',
        url: `${ApiTable.getTypeDistribution}`,
        msg: { error: '获取知识产权类型分布占比失败' },
        reducer: { name: 'typeDistribution' }
    });
}

//获取知识产权统计数据
export function getStats() {
    return dispatch => basicAction({
        type: 'get',
        dispatch: dispatch,
        actionType: 'GET_STATS',
        url: `${ApiTable.getStats}`,
        msg: { error: '获取知识产权统计数据失败' },
        reducer: { name: 'stats' }
    });
}

//获取各个关联产品的知识产权统计
export function getProductRelatedIPStats() {
    return dispatch => basicAction({
        type: 'get',
        dispatch: dispatch,
        actionType: 'GET_PRODUCT_RELATED_IP_STATS',
        url: `${ApiTable.getProductRelatedIPStats}`,
        msg: { error: '获取关联产品知识产权统计失败' },
        reducer: { name: 'productRelatedIPStats' }
    });
}
